package com.woniu.service.productcommand;

import com.woniu.outlet.mysql.po.Product;
import com.woniu.util.ApplicationContextHolder;
import lombok.Data;

/**
 * @description:
 * @author: my
 * @time: 2021/4/26 18:54
 */
@Data
public class GetProductCommand {
    private GetProductCommandHandler handler;
    private Integer id;

    public GetProductCommand(){
        this.handler =
                ApplicationContextHolder.getApplicationContext().getBean(GetProductCommandHandler.class);
    }

    public GetProductCommand(Integer id){
        this();
        this.id = id;
    }

    public Product execute(){
        return this.handler.action(this);
    }
}
